home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
cafead1a
/
runme.bas
< prev
next >
Wrap
BASIC Source File
|
1999-09-10
|
965b
|
21 lines
Attribute VB_Name = "RunMe"
'******************RunMe.bas****************************
' Opens any file type in its associated program.
' With module added it takes one line of code.
' Add: Run Me, "full pathname" to control event.
' Example 1: Run Me, "C:\Windows\notepad.exe"
' Example 2: Run Me, "C:\scandisk.log"
' Code also shows a way to get the Directory (path)
' from a full path and filename without a For Next
' statement.
'*******************************************************
Option Explicit
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub Run(frm As Form, filename As String)
Dim lRtn As Long
filename = Trim(filename)
lRtn = ShellExecute(frm.hwnd, "Open", filename, "", Left(filename, Len(filename) - Len(Dir(filename, 0))), 1)
End Sub